<?php echo form_open($this->config->item('admin_folder').'/settings/send_mail_to_customers/'); ?>
	<?php if($this->session->flashdata("success")){?><style>.success{background:#23E41E;padding:5px;}</style><p class="success"><?php echo $this->session->flashdata("success")?></p><?php }?>
	<label for="name">Khách hàng </label>
    <select id="form_mail" name="type_customer" style="width:282px">
    	<option value="0">Gởi tất cả </option>
        <?php if($type_customer) foreach($type_customer as $item) echo '<option value="'.($item->id+10).'">'.$item->name.'</option>'?>
        <option value="2">Đăng ký nhận tin</option>
        <option value="3">Khác</option>
        
    </select>
    <div id="input_email" style="display:none">
    <label for="subject">Email</label>
	<?php echo form_input(array('name'=>'email', 'class'=>'input-xlarge', 'style'=>'width:50%','placeholder'=>'Mõi email cách nhau bằng dấu phẩy ( , )'));?>
    </div>
	
	<label for="subject">Form </label>
    <select id="form_mail" name="form_mail" style="width:282px">
    	<option value="">Chọn mail cần gởi</option>
		<?php foreach($canned_messages as $message){?>
    	<option value="<?php echo $message['id']?>"><?php echo $message['name']?></option>
        <?php }?>
    </select>
	<div class="form-actions">
		<input class="btn btn-primary" type="submit" value="<?php echo lang('save');?>"/>
	</div>
</form>
<script type="text/javascript">
	$('form').submit(function() {
		if(confirm(""))
		$('.btn').attr('disabled', true).addClass('disabled');
	});
	$('#form_mail').change(function(){
		var option = $(this).find('option:selected').val();	
		if(option==3) $('#input_email').show();
		else $('#input_email').hide();
	});
</script>

<script type="text/javascript">
function areyousure()
{
    return confirm('<?php echo lang('confirm_are_you_sure');?>');
}
</script>